﻿#ifndef TYPECONVERT_H
#define TYPECONVERT_H

#include "ObjLib_global.h"

namespace xvs {



class OBJLIB_EXPORT TypeConvert
{
public:
    TypeConvert();

    static bool canConvert(const QString& srcType,const QString& dstType);

    static std::function<QVariant(QVariant)> convertFunc(const QString& srcType,const QString& dstType);

    static void addConvert(const QString& srcType,const QString& dstType,std::function<QVariant(QVariant)> func);

private:
    inline static QMap<QPair<QString,QString>,std::function<QVariant(QVariant)>>& cvtFunctions(){
        static QMap<QPair<QString,QString>,std::function<QVariant(QVariant)>> _instances;
        return _instances;
    }
};

}

#endif // TYPECONVERT_H
